/*
 * Timer.cpp
 *
 *  Created on: Aug 29, 2011
 *      Author: user
 */

#include "bilbao/util/Timer.h"

namespace bilbao
{
	namespace util
	{
		//--------------------------------------------------------------------------------
		//--------------------------------------------------------------------------------
		//--------------------------------------------------------------------------------
		// Class Timer
		//--------------------------------------------------------------------------------
		Timer::Timer()
			: Thread()
		{

		}
		//--------------------------------------------------------------------------------
		Timer::Timer(long limit)
			:  Thread(),  currTime(0), limitTime(limit)
		{

		}
		//--------------------------------------------------------------------------------
		Timer::~Timer()
		{

		}
		//--------------------------------------------------------------------------------
		void Timer::run()
		{
			std::time_t ini = std::time(0);
			std::time_t end;

			do
			{
				end = std::time(0);
				currTime = (long)difftime(end, ini);
			} while ( currTime != limitTime );
		}
		//--------------------------------------------------------------------------------
	}
}

